Skip to content

[protobuf] Add _loaded_options to FileDescriptor#15677

Merged
JelleZijlstra merged 1 commit intopython:mainfrom
anuraaga:patch-1
May 2, 2026
Merged

[protobuf] Add _loaded_options to FileDescriptor#15677
JelleZijlstra merged 1 commit intopython:mainfrom
anuraaga:patch-1

Conversation

@anuraaga
Copy link
Copy Markdown
Contributor

protobuf renamed _loaded_options to _options in 6.x but continues to support the old name for compatibility with 5.x, which they explicitly still support (actually as this is about gencode, technically they still support back to 3.x)

https://protobuf.dev/support/version-support/

As it is still there in the latest version of protobuf, I guess the stub should reflect that

https://github.com/protocolbuffers/protobuf/blob/760418056a557866afc31860297b9034ef9ade1e/python/google/protobuf/descriptor.py#L140

Note, this came up because #15569 did a good job of updating type definitions throughout - but it means that previously the result of AddSerializedFile was Any and now it is FileDescriptor. This causes the latest version of typeshed to fail to typecheck 5.x gencode where previously it succeeded.

@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/computation/ops.py:328: error: Need type annotation for "_binary_ops_dict" (hint: "_binary_ops_dict: dict[<type>, <type>] = ...")  [var-annotated]

@JelleZijlstra JelleZijlstra merged commit 66c79ef into python:main May 2, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants